In environments that provide managed code execution, such as with the Common Language Runtine (CLR) provided by MICROSOFT® or with Java, an object and its state usually have one and the same lifetime. In other words, when a garbage collector reclaims the memory used by an object, all of the object's associated state goes away. Some objects, however, such as those accessing the file system, must interact with data outside of the garbage collector's heap. A finalizer method is often provided for such objects to ensure that an object's external state can be cleaned up just before its memory is reclaimed.
Current software transactional memory (STM) systems do not support finalization of objects. Software transactional memory is a concurrency control mechanism analogous to database transactions for controlling access to shared memory in concurrent computing. A transaction in the context of transactional memory is a piece of code that executes a series of reads and writes to shared memory.